

inherit "inherit/char";

number load(){
}
 var heartbeat(){

    attack();
    if( query("canRandomMove") ){
        randomMove();
    }
//    randomMove();
//    println("我在"+environment(toObj(this)));
//    println("我在"+baseName(environment(toObj(this))));
 }


 //随机走动
 number randomMove(){

    map exits;
 	string *dirs;

     if( !environment(this) ){
         println("环境有问题");
         return 0;
     }

     if (! mapp( (exits = environment(this).query("exits"))) ) return 0;


     dirs = keys(exits);

 	if ( sizeof(dirs)<=0 ) return 0;
    if( randomRange(0,10)  > 8 ){
        command(this,"go " + dirs[randomRange(0,sizeof(dirs))]);
    }


 }